/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Heinz Hernandez
 */
@Entity
@Table(name = "employee")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e"),
    @NamedQuery(name = "Employee.findByEmplId", query = "SELECT e FROM Employee e WHERE e.emplId = :emplId"),
    @NamedQuery(name = "Employee.findByEmplUser", query = "SELECT e FROM Employee e WHERE e.emplUser = :emplUser"),
    @NamedQuery(name = "Employee.findByEmplPass", query = "SELECT e FROM Employee e WHERE e.emplPass = :emplPass")})
public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "EMPL_ID")
    private Long emplId;
    @Basic(optional = false)
    @Column(name = "EMPL_USER")
    private String emplUser;
    @Basic(optional = false)
    @Column(name = "EMPL_PASS")
    private String emplPass;
    @JoinColumn(name = "PER_ID", referencedColumnName = "PER_ID")
    @ManyToOne
    private Person perId;

    public Employee() {
    }

    public Employee(Long emplId) {
        this.emplId = emplId;
    }

    public Employee(Long emplId, String emplUser, String emplPass) {
        this.emplId = emplId;
        this.emplUser = emplUser;
        this.emplPass = emplPass;
    }

    public Long getEmplId() {
        return emplId;
    }

    public void setEmplId(Long emplId) {
        this.emplId = emplId;
    }

    public String getEmplUser() {
        return emplUser;
    }

    public void setEmplUser(String emplUser) {
        this.emplUser = emplUser;
    }

    public String getEmplPass() {
        return emplPass;
    }

    public void setEmplPass(String emplPass) {
        this.emplPass = emplPass;
    }

    public Person getPerId() {
        return perId;
    }

    public void setPerId(Person perId) {
        this.perId = perId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (emplId != null ? emplId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employee)) {
            return false;
        }
        Employee other = (Employee) object;
        if ((this.emplId == null && other.emplId != null) || (this.emplId != null && !this.emplId.equals(other.emplId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Employee[ emplId=" + emplId + " ]";
    }
    
}
